<template>
  <div class="number-item-block" :style="'background-image: linear-gradient('+color[0]+','+color[1]+')'">
    <div class="number">{{thousands}}</div>
    <div class="name-block">
      <div class="icon iconfont" :class="icon"></div>
      <div class="name">{{name}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "NumberItem",
  props:{
    name:{
      type:String,
      default:'',
    },
    icon:{
      type:String,
      default:'',
    },
    number:{
      default:0,
    },
    color:{
      type:Array,
      default:()=>['#0a88ec','#2b59f7']
    }
  },
  computed:{
    thousands(){
      return typeof this.number==='number'?this.number.toLocaleString():this.number;
    }
  }
}
</script>

<style scoped lang="scss">
.number-item-block{
  display: flex;
  flex-direction: column;
  padding: 10px;
  padding-top: 2px;
  height: 100%;
  border-radius: 5px;

  cursor: pointer;
  .name,.icon,.number{
    color: #fff;
  }
  .name-block{
    width: 100%;
    display:flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    font-size: 12px;

    .icon{
      margin-right: 5px;
    }
  }
  .number{
    text-align: center;
    font-size: 20px;

    font-weight: bold;
  }
}
</style>
